<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .wx{
            width: 100px;
            height: 100px;
            border: solid grey 1px;
        }
    </style>
</head>
<body>
    <div id="app">
        {{msg}}
        <aa :msg='msg' @myclick='show'></aa>
    </div>
    <script src="../js/vue.js"></script>
    <script>
        var aa={
            props: ['msg'],
            template :`<div class="wx">
                
                    <button @click='dian'>传输</button>
                </div>`,
            methods: {
                dian:function(){
                    this.$emit('myclick','new value')
                }
            }
        }
           
           
        var app=new Vue({
            el:'#app',
            methods: {
                show:function(data){
                    console.log('子组件传来的'+data);
                    this.msg=data
                }
            },
            data:{
                msg:'cnm'
            },
            components: {
                aa
            }

            
        })

    </script>
</body>
</html>